#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
	int i, j, x, y, s = 7, score = 0, killed = 0;
	char input, fire = 0, kill = 0;
	x = 5;
	y = 10;
	while (1)
	{
		system("cls");
		if (kill == 0)
		{
			for (i = 1; i < s; i++)
				printf(" ");
			printf("+\n");
		}
		if (kill == 1)
		{
				s = s + 5;
			for (i = 1; i < s; i++)
				printf(" ");
			printf("+\n");
			kill = 0;
		}												//靶子
		if (fire == 0)
		{
			for (i = 1; i < x; i++)
				printf("\n");
		}
		else
		{
			for (i = 1; i < x; i++)
			{
				for (j = 1; j < y; j++)
					printf(" ");
				printf("|\n");
			}
			if (y == s)
			{
				kill = 1;
				killed = killed + 1;
				score = score + 1;
			}
			fire = 0;
		}								//命中

		for (j = 1; j < y; j++)
			printf(" ");
		printf("*\n");
		for (j = 1; j < y - 2; j++)
			printf(" ");
		printf("*****\n");
		for (j = 1; j < y - 1; j++)
			printf(" ");
		printf("* *\n");				//飞机
		for (i = x + 2; i <= 20; i++)
			printf("\n");
		printf("score=%d\n", score);		//得分


		input = getch();
		if (input == 'a')
			y--;
		if (input == 'd')
			y++;
		if (input == 'w')
			x--;
		if (input == 's')
			x++;
		if (input == ' ')
			fire = 1;					//控制
	}
}